# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: Douglas Soares de Andrade <dsa@aur.archlinux.org>
# Contributor: Bodor Dávid Gábor <david.gabor.bodor@gmail.com>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>

_name=scipy
pkgname=python-scipy
pkgver=1.10.1
pkgrel=3
pkgdesc='Open-source software for mathematics, science, and engineering'
arch=(loong64 x86_64)
url='https://www.scipy.org/'
license=(BSD)
depends=(python-numpy python-pooch)
provides=(scipy)
makedepends=(gcc-fortran cython python-pythran pybind11 meson-python python-build python-installer)
checkdepends=(python-pytest)
optdepends=('python-pillow: for image saving module')
source=(https://pypi.python.org/packages/source/${_name:0:1}/$_name/$_name-$pkgver.tar.gz)
sha256sums=('2cf9dfb80a7b4589ba4c40ce7588986d6d5cebc5457cad2c2880f6bc2d42f3a5')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation --skip-dependency-check \
    -C setup-args=-Dblas=blas \
    -C setup-args=-Dlapack=lapack
}

check() {
  cd $_name-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  cd test-env
  bin/python -c "from scipy import test; test('full')"
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname
}
